package com.rabbitmq.learn.topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.learn.common.ConnectionUtils;
import com.rabbitmq.learn.common.RabbitMqConstant;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * Created by Lxk on 2019/8/13.
 */
public class Sender {

    public static void main(String[] args) throws IOException, TimeoutException {
        Connection con = ConnectionUtils.getConnection();

        Channel channel = con.createChannel();

        channel.exchangeDeclare(RabbitMqConstant.Topic.EXCHANGE_NAME,"topic");

        String msg = "商品 truely update...";
        channel.basicPublish(RabbitMqConstant.Topic.EXCHANGE_NAME,  "good.update",null,msg.getBytes());

        System.out.println("msg send ...");

        channel.close();
        con.close();;
    }

}
